package com.qiankan.qmsj.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;

import com.qiankan.qmsj.MainActivity;
import com.qiankan.qmsj.R;
import com.qiankan.qmsj.widget.bannerViewPager.BannerViewPager;
import com.qiankan.qmsj.widget.bannerViewPager.OnPageClickListener;
import com.qiankan.qmsj.widget.bannerViewPager.ViewPagerAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class SplashActivity extends BaseActivity {
    @BindView(R.id.splash)
    BannerViewPager splash;

    @Override
    public int getContentViewId() {
        return R.layout.activity_splash;
    }

    @Override
    protected void initAllMembersView(Bundle savedInstanceState) {
        List<View> dataList = new ArrayList<>();
        dataList.add(LayoutInflater.from(this).inflate(R.layout.splash1, null));
        dataList.add(LayoutInflater.from(this).inflate(R.layout.splash2, null));
        dataList.add(LayoutInflater.from(this).inflate(R.layout.splash3, null));
        ViewPagerAdapter splashAdapter = new ViewPagerAdapter(dataList, new OnPageClickListener() {
            @Override
            public void onPageClick(View view, int position) {
                if (position == 2) {
                    startActivity(new Intent(SplashActivity.this, MainActivity.class));
                    finish();
                }
            }
        });
        splash.hideIndicator();
        splash.setAutoRolling(false);
        splash.setAdapter(splashAdapter);
    }
}
